The World Wide Web (WWW) originated in 1989, and uses a browser-server structure. By using the World Wide Web, a user can access, by using a web browser, rich information resources provided on a web server. Generally, files on the web server are stored in a file system on the web server. The web server maps, by using an organization structure in which a uniform resource locator (URL) corresponds to a filename, a URL received from the web browser into a file in a local file system. For example, server software is configured on a web server for a website “example.funnycorp.com”, and a root directory of the web server software is set to “/home/public/web/”. After a user enters a URL http://example.funnycorp.com/lips/raspberry.html on a web browser, the web browser sends a HyperText Transfer Protocol (HTTP) request to the web server, and the web server at “example.funnycorp.com” receives the HTTP request, and reads a file “/home/public/web/lips/raspberry.html”. The file is carried in an HTTP response to return to the web browser. An HTTP response generally includes a Hypertext Markup Language (HTML) file, and may also include a text file, an image, or a file of another type. After downloading the received HTML file, the web browser caches the file in a local temporary folder. When the browser needs to access this website again, the browser directly reads the file from the cache instead of downloading it again from the web server, thereby speeding up website access. However, a file on the web server may be updated with an update of the website, and therefore, a mechanism is required to ensure that a latest file can be obtained by a browser during website access.
A file update mechanism based on file content hash is provided in the prior art to ensure dynamic updating of a web page. Specifically, a URL corresponding to a file stored on a web server is an absolute path. For example, a format of an absolute path for a file logo.gif is “/directory/subdirectory/ . . . /logo.gif”. When the website is upgraded, if the file logo.gif is updated, a filename is changed to logo_hashcode.gif, where hashcode is a hash value calculated based on content of the file logo.gif. Each time when file content changes, hashcode is recalculated. Accordingly, the absolute path is changed to “/directory/subdirectory/ . . . /logo_hashcode.gif”, and a user's browser of can obtain a latest file logo.gif according to this absolute path. In this manner, the dynamic updating of a web page is implemented.
However, files on the web server are mutually referenced. When another file has referenced logo.gif, a change of the filename of logo.gif causes a change of file content of the file that has referenced logo.gif, and consequently hashcode of the file that has referenced logo.gif needs to be recalculated according to changed file content. For example, a file a.js references logo.gif. When logo.gif changes, its filename changes to logo_hashcode.gif. In this case, file content of the file a.js changes accordingly, and its filename changes to a_hashcode.js. Therefore, in the prior art, when one file on a web server is updated, all files depending on the file are updated accordingly, which results in updating of massive files and increases risks in website upgrading.